Release 10.1A: OpenEdge Development:
Web Services


Preparing the schema and data for input TABLE-HANDLE parameters

This example shows how you might prepare the schema and data for an input TABLE-HANDLE parameter using the helper classes described in the previous section:

// Build up a simple RowSet object representing the input dynamic TEMP-TABLE.  
RowSet rsIn = new RowSet( ); 
// Create the MetaData, consisting of String and Integer columns 
ColumnMetaData[] schema = new ColumnMetaData[2]; 
ColumnMetaData firstCol = new ColumnMetaData("Name", 
                                              ColumnMetaData.CHAR_TYPE, 0); 
ColumnMetaData secondCol = new ColumnMetaData("Number", 
                                               ColumnMetaData.INT_TYPE, 0); 
schema[0] = firstCol; 
schema[1] = secondCol; 
rsIn.setSchema(schema); 
// Create a data row and add to the RowSet 
Vector row; 
row = new Vector( ); 
row.addElement(new String("Sally Jones")); 
row.addElement(new Integer(1)); 
rsIn.addRow(row); 
// Convert the RowSet into a TableHandleParam Object, 
// the input parameter for DynTT.p 
// Get the RowSet as a DOM Element.  This element has two 
// children, a <schema> element and a <Data> element 
Element dataSetIn = rsIn.getDataSetAsDom( ); 
// Create a MessageElement containing the DataSet 
MessageElement dataSetMsgEl = new MessageElement(dataSetIn); 
// Place the DataSet MessageElement into the message element array 
// and create the TableHandleParam object 
MessageElement msgArrayIn[] = new MessageElement[1]; 
msgArrayIn[0] = dataSetMsgEl; 
// Create the TableHandleParam object, ttHandle, representing the  
// dynamic TABLE-HANDLE parameter 
TableHandleParam ttHandle = new TableHandleParam( ); 
ttHandle .set_any(msgArrayIn); 
... 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095